﻿using Microsoft.Extensions.DependencyInjection;
using SX.ServiceDiscovery.Abstractions;

namespace SX.ServiceDiscovery.Consul.Extensions
{
    public static class ServiceCollectionExtensions
    {
        public static IServiceDiscoveryBuilder UseConsul(this IServiceDiscoveryBuilder builder)
        {
            builder.Services.Configure<ConsulServiceDiscoveryConfiguration>(builder.Configuration.GetSection("ServiceDiscovery:Consul"));
            builder.Services.AddSingleton<IServiceDiscovery, ConsulServiceDiscovery>();
            return builder;
        }
    }
}
